/**
 * 
 */
package com.edooschool.webpay.entity.prepare;

import org.apache.commons.lang3.StringUtils;

import com.edooschool.webpay.entity.PayChannel;

/**
 * @author downpour
 *
 */
public class PrepareRequest {
    
    /** 
     * 订单号
     * 
     *  - 必填字段 
     */
    private String orderNo;
    
    /**
     * 支付请求号
     * 
     *  - 必填字段
     */
    private String requestNo;
    
    /**
     * 用户ID
     * 
     *  - 必填字段   (openid|userId)
     */
    private String userId;
    
    /**
     * 支付通道
     * 
     *  - 必填字段   (alipay|wechatpay)
     */
    private String channel;

    /**
     * 支付金额
     * 
     *  - 必填字段
     *  - 单位为分
     */
    private int amount;

    /**
     * 支付抬头
     * 
     *  - 必填字段
     */
    private String subject;
    
    /**
     * 支付描述
     * 
     *  - 非必填字段
     */
    private String body;
    
    /**
     * IP地址
     * 
     *  - 非必填字段
     */
    private String remoteIp;
    
    /**
     * The default constructor
     */
    public PrepareRequest() {
        
    }

    /**
     * 
     * @return
     */
    public boolean isValid() {
        return StringUtils.isNotBlank(this.orderNo)
            && StringUtils.isNotBlank(this.requestNo)
            && StringUtils.isNotBlank(this.userId)
            && StringUtils.isNotBlank(this.channel)
            && PayChannel.supports(this.channel) 
            && amount > 0;
    }
    
    /**
     * @return the orderNo
     */
    public String getOrderNo() {
        return this.orderNo;
    }
    
    /**
     * @return the requestNo
     */
    public String getRequestNo() {
        return this.requestNo;
    }
    
    /**
     * @return the userId
     */
    public String getUserId() {
        return this.userId;
    }

    /**
     * @return the channel
     */
    public String getChannel() {
        return this.channel;
    }

    /**
     * @return the amount
     */
    public int getAmount() {
        return this.amount;
    }

    /**
     * @return the subject
     */
    public String getSubject() {
        return this.subject;
    }

    /**
     * @return the body
     */
    public String getBody() {
        return this.body;
    }

    /**
     * @return the remoteIp
     */
    public String getRemoteIp() {
        return this.remoteIp;
    }

    /**
     * @param orderNo the orderNo to set
     */
    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }
    
    /**
     * @param requestNo the requestNo to set
     */
    public void setRequestNo(String requestNo) {
        this.requestNo = requestNo;
    }
    
    /**
     * @param userId the userId to set
     */
    public void setUserId(String userId) {
        this.userId = userId;
    }

    /**
     * @param channel the channel to set
     */
    public void setChannel(String channel) {
        this.channel = channel;
    }

    /**
     * @param amount the amount to set
     */
    public void setAmount(int amount) {
        this.amount = amount;
    }

    /**
     * @param subject the subject to set
     */
    public void setSubject(String subject) {
        this.subject = subject;
    }

    /**
     * @param body the body to set
     */
    public void setBody(String body) {
        this.body = body;
    }

    /**
     * @param remoteIp the remoteIp to set
     */
    public void setRemoteIp(String remoteIp) {
        this.remoteIp = remoteIp;
    }

}
